package org.itsky.study.test4;

/**
 * @Author sky
 * @Site cmtianxie163.com 2020/4/16 10:50
 */
public class ThreadTest2 {
    public static void main(String[] args) {
        Thread t1 = new Thread(new MyRunnable());
        t1.setName("线程一");
        t1.start();

        for (int i = 0; i < 300; i++) {
            if(i % 2 == 0){
                System.out.println(Thread.currentThread().getName() + ">>> " + i);
            }
        }
    }


}

class MyRunnable implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 300; i++) {
            if(i % 2 == 0){
                System.out.println(Thread.currentThread().getName() + ">>> " + i);
            }
        }
    }
}